import { getMaterialList } from '@/api/wechat'

const user = {
  state: {
    materialList: ''
  },

  mutations: {
    SET_MaterialList: (state, materialList) => {
      state.materialList = materialList
    }
  },

  actions: {
    // 登录
    getMaterialList({ commit }, params) {
      return new Promise((resolve, reject) => {
        getMaterialList(params).then(response => {
          const data = response.data
          commit('SET_MaterialList', data)
          resolve()
        }).catch(error => {
          reject(error)
        })
      })
    }
  }
}

export default user
